package com.tanhua.model.vo;

import com.tanhua.model.domain.UserInfo;
import com.tanhua.model.mongo.Voice;
import lombok.Data;

import java.io.Serializable;

/**
 * Created by IntelliJ IDEA.
 * User: 许志民
 * Date: 2022-01-09
 */
@Data
public class VoiceVo implements Serializable {
    //用户id
    private Integer id;
    //头像
    private String avatar;
    //昵称
    private String nickname;
    //性别
    private String gender;
    //年龄
    private Integer age;
    //语音地址
    private String soundUrl;
    //剩余次数
    private Integer remainingTimes;

    public static VoiceVo init(UserInfo userInfo, Voice voice){
        VoiceVo voiceVo = new VoiceVo();
        voiceVo.setId(Integer.parseInt(userInfo.getId().toString()));
        voiceVo.setAge(userInfo.getAge());
        voiceVo.setAvatar(userInfo.getAvatar());
        voiceVo.setGender(userInfo.getGender());
        voiceVo.setNickname(userInfo.getNickname());
        voiceVo.setSoundUrl(voice.getVoiceUrl());
        return voiceVo;
    }

}
